/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package trefliq.EJB.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;

/**
 *
 * @author dsimmons
 */
@Entity
@NamedQueries ({
    @NamedQuery(name="findAllOrders", query="select o from Orders o"),
    @NamedQuery(name="findOrderById", query = "SELECT o FROM Orders o WHERE o.id = :id"),
    @NamedQuery(name="findOrdersByCustomerId", query="select o from Orders o where o.customerId = :cid"),
    @NamedQuery(name="findOrdersByDate", query="select o from Orders o where o.dateCreated = :date"),    
    @NamedQuery(name="findOrdersByStatus", query="select o from Orders o where o.status = :status")    
})
public class Orders implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
//    @NotNull
    @Column(name = "ID", nullable = false)
//    @GeneratedValue(strategy=GenerationType.TABLE, generator="ORDERS")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    //@JoinColumn(name="CUSTOMER_ID", referencedColumnName="CUSTOMER_ID")
    //@ManyToOne(optional=false)
    private Long customerId;
    
    @Temporal(TemporalType.DATE)
    //@Column(name="DATE_CREATED")
    private Date dateCreated;
    
    //@Column(name="STATUS")
    private String status;
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }

    public Date getDateCreated() {
        return dateCreated;
    }

    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Orders)) {
            return false;
        }
        Orders other = (Orders) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "trefliq.persistence.entity.Orders[ id=" + id + " ]";
    }
    
}
